<template>
    <div class="top-box-item">
        <el-card class="item-content" shadow="hover">
            <div class="flex">
                <div>
                    <el-image src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
                        style="width: 150px; height: 150px"></el-image>
                </div>
                <div class="user-info">
                    <h3>欢迎访问小青云盘后台管理</h3>
                    <div>
                        <el-descriptions :column="1">
                            <el-descriptions-item label="账号">{{ adminInfo.username }}</el-descriptions-item>
                            <el-descriptions-item label="昵称">{{ adminInfo.nickname }}</el-descriptions-item>
                            <el-descriptions-item label="性别">男</el-descriptions-item>
                            <el-descriptions-item label="邮箱">{{ adminInfo.email }}</el-descriptions-item>
                            <el-descriptions-item label="身份">
                                <span v-for="item, index in adminInfo.role" :key="index">
                                    <el-tag size="small" v-show="item == 2">管理员</el-tag>
                                    <el-tag size="small" v-show="item == 3">超级管理员</el-tag>
                                    <el-tag size="small" v-show="item == 4">权限管理员</el-tag>
                                </span>
                            </el-descriptions-item>
                            <el-descriptions-item label="简介">{{ adminInfo.introduce }}</el-descriptions-item>
                        </el-descriptions>
                    </div>
                </div>
            </div>
        </el-card>
    </div>
</template>

<script>
export default {
    name: "admin-info",
    computed: {
        adminInfo() {
            return this.$store.state.user.userInfo || {}
        }
    }
}
</script>

<style scoped>
.top-box-item {
    width: 45%;
}

.item-content {
    width: 100%;
}

.flex {
    display: flex;
    align-items: center;
}

.user-info {
    margin-left: 20px;
    width: calc(100% - 170px);
    text-align: center;
}
</style>